

import { result, qsparse } from '../util'
let provinces = require('./area/provinces.json')
let cities = require('./area/cities.json')
let areas = require('./area/areas.json')
export default {
  'get|/api/area/getAllProvince': result(provinces),
  'get|/api/area/getCity': (option) => {
    const codeObj = qsparse(option.body)
    const cityList = cities.filter(item => {
      return item.provinceCode === codeObj.code
    })
    return result(cityList)
  },
  'get|/api/area/getArea': (option) => {
    const codeObj = qsparse(option.body)
    const areasList = areas.filter(item => {
      return item.cityCode === codeObj.code
    })
    return result(areasList)
  }
}
